import request from "@/util/request";

/** 此处后端没有提供注释 POST /app/add */
export async function addApp(
  body: API.AppAddDTO,
  options?: { [key: string]: any }
) {
  return request<API.Result>("/app/add", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /app/delete */
export async function deleteApp(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.deleteAPPParams,
  options?: { [key: string]: any }
) {
  return request<API.Result>("/app/delete", {
    method: "POST",
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /app/edit */
export async function editApp(
  body: API.AppEditDTO,
  options?: { [key: string]: any }
) {
  return request<API.Result>("/app/edit", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /app/query/all */
export async function queryAllApp(
  body: API.AppQueryDTO,
  options?: { [key: string]: any }
) {
  return request<API.ResultResultPageAppVo>("/app/query/all", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /app/query/one/${param0} */
export async function queryOneByIdApp(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.queryOneByIdAppParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.ResultAppVo>(`/app/query/one/${param0}`, {
    method: "GET",
    params: { ...queryParams },
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 POST /app/update */
export async function updateApp(
  body: API.AppUpdateDTO,
  options?: { [key: string]: any }
) {
  return request<API.Result>("/app/update", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/**获取app应该的id和名称map*/
export async function queryAppIdAndNameMap(
  params: any,
  options?: { [key: string]: any }
) {
  return request<API.ResultAppVo>(`/app/appIdName`, {
    method: "GET",
    params: params,
    ...(options || {}),
  });
}
